<template>
  <RouterView />
</template>

<script name="App" lang="ts" setup>
  import { watch } from 'vue';
  import { RouterView, useRoute } from 'vue-router';
  import { useSessionStorage } from '@vueuse/core';

  const appTitle = import.meta.env.VITE_APP_TITLE;

  const route = useRoute();

  watch(route, () => {
    const { meta, path, fullPath } = route;
    document.title =
      meta.module && meta.title ? `${meta.module} - ${meta.title}` : appTitle;
    if (path !== '/404' && fullPath !== '/') {
      useSessionStorage('url', fullPath);
    }
  });
</script>
